home *** CD-ROM | disk | FTP | other *** search
/ Aminet 30 / Aminet 30 (1999)(Schatztruhe)[!][Apr 1999].iso / Aminet / mus / edit / PlotCMD.lha / plotcmd / cmd_0-40.omed next >
Text File  |  1999-02-16  |  1KB  |  56 lines

  1. /*
  2.     ARexx script for use with PlotCMD
  3.     (PlotCMD is a MUIRexx script for use with OctaMED Soundstudio)
  4.     Read the PlotCMD doc for details
  5. */
  6.  
  7. ADDRESS OCTAMED_REXX
  8. OPTIONS RESULTS
  9.  
  10. PARSE ARG cmd                    /* Argument = command in hex (ex: 0C) */
  11.  
  12. IN_SELECT LAST
  13. CALL checkifsample()
  14.  
  15. SA_GETSAMPLELENGTH VAR samplen
  16. ED_GETNUMLINES VAR blocklen
  17.  
  18. len=MIN(samplen, blocklen)
  19.  
  20. ED_SETDATA_UPDATE OFF
  21.  
  22. DO i=0 TO len-1
  23.    SA_GETSAMPLE OFFSET i
  24.    level=(RESULT+32767)/1024            /* Convert to 0-64 values */
  25.    level=round(level)                /* Round to nearest integeer */
  26.    ED_SETDATA LINE i CMDNUM X2D(cmd) CMDLVL level
  27. END
  28.  
  29. ED_SETDATA_UPDATE ON
  30. ED_SETDATA_UPDATE
  31.  
  32. EXIT
  33.  
  34.  
  35.  
  36.  
  37.  
  38. /*              P R O C E D U R E S
  39. -----------------------------------------------------*/
  40.  
  41. round: PROCEDURE
  42.    PARSE ARG nr
  43.    IF (nr-TRUNC(nr))>=0.5 THEN
  44.       nr=TRUNC(nr)+1
  45.    ELSE
  46.       nr=TRUNC(nr)
  47. return nr
  48.  
  49. checkifsample: PROCEDURE
  50.    IN_GETTYPE VAR type
  51.    IF ~(type == SAMPLE | type == SAMPLE16) THEN DO
  52.       WI_REQUEST '"No sample!"' '"Ok"'
  53.       EXIT
  54.    END
  55. return
  56.